package com.example.seckill.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.seckill.domain.PromoDO;
import com.example.seckill.mappstruct.PromoMap;
import com.example.seckill.service.PromoService;
import com.example.seckill.mapper.PromoMapper;
import com.example.seckill.service.model.PromoModel;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class PromoServiceImpl extends ServiceImpl<PromoMapper, PromoDO> implements PromoService {

    @Override
    public PromoModel findByItemId(Integer itemId) {
        PromoDO promoDO = this.getOne(new QueryWrapper<PromoDO>().lambda().eq(PromoDO::getItemId, itemId));
        PromoModel promoModel = PromoMap.INSTANCE.convertFromDO(promoDO);
        return promoModel;
    }
}




